package com.dubbo.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.common.entity.MyResponse;
import com.dubbo.api.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Reference
    UserService userService;

    @GetMapping("/findById/{id}")
    public MyResponse findById(@PathVariable Long id){
        return new MyResponse().success().data(userService.findById(id));
    }

    @GetMapping("/listUser")
    public MyResponse listUser(){
        return new MyResponse().success().data(userService.listUser());
    }
}
